using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

namespace LabMS.Web.ProjectApp
{
    public partial class TeachingReformList : Base.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack) 
            {
                DataBinds();
            }
        }

        protected void DataBinds() 
        {
            Gv_DataBinds();
        }

        

        protected void Gv_DataBinds() 
        {
            ExtendBLL.TeachReformAndOther Reform = new ExtendBLL.TeachReformAndOther();
            List<ExtendModule.TeachReformAndOther> ls = new List<ExtendModule.TeachReformAndOther>();
            ls = Reform.GetModelList2(ComBineStr());
            Gv_Reform.DataSource = ls;
            Gv_Reform.DataBind();
        }

        protected string ComBineStr() 
        {
            string strWhere="";
            if (ddl_QueryType.SelectedValue != "0"&&!string.IsNullOrEmpty(tb_KeyWord.Text)) 
            {
                strWhere += ddl_QueryType.SelectedValue + "='" + tb_KeyWord.Text.Trim()+"'";
            }
            
            return strWhere;
        }

        protected void Search_Click(object sender, EventArgs e)
        {
            Gv_DataBinds();
        }

        protected void Gv_Reform_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow) 
            {
                //e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';this.style.color='#003399'");
                //e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#6699FF';this.style.color='#8C4510'");
                e.Row.Attributes["style"] = "Cursor:pointer";
                
                //e.Row.Attributes.Add("OnDblClick", "window.location.href='consumpreview.aspx?ID="
                //    + gv_Project.DataKeys[e.Row.DataItemIndex].Value.ToString() + "'");
                e.Row.Attributes.Add("OnDblClick", "window.location.href='TeachReformPreview.aspx?ID=" + Gv_Reform.DataKeys[e.Row.DataItemIndex].Value.ToString() + " '");
               
            }
        }
    }
}
